package lesson24.grpc.impl;

import io.grpc.stub.StreamObserver;
import lesson24.grpc.StudentServiceGrpc;
import lesson24.proto.MyRequest;
import lesson24.proto.MyResponse;

import static lesson24.grpc.StudentServiceGrpc.*;

/**
 * 服务类实现<br/>
 * Created on : 2018-11-05 23:05
 * @author lizebin
 */
public class StudentServiceImpl extends StudentServiceImplBase {

    @Override
    public void getRealNameByUserName(MyRequest request, StreamObserver<MyResponse> responseObserver) {
        System.out.println("request.username = " + request.getUsername());
        MyResponse myResponse = MyResponse.newBuilder().setRealname("lizebin").build();
        responseObserver.onNext(myResponse);
        responseObserver.onCompleted();
    }
}
